package com.bicon.life.core.base.common.Enum;

/**
 * @Author: sx
 * @Date: Created in 17:45 2017/6/14/014
 */
public enum GenderType {

    /**
     * 未设置
     */
    UNKNOWN(0),
    /**
     * 男
     */
    MEN(1),
    /**
     * 女
     */
    WOMEN(2);

    /**
     * 类型
     */
    private int type;

    GenderType(int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    /**
     * 根据key获取value
     *
     * @param key : 键值key
     * @return String
     */
    public static int getValueByKey(GenderType key) {
        GenderType[] enums = GenderType.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i] == key) {
                return enums[i].getType();
            }
        }
        return UNKNOWN.getType();
    }
}
